<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="index/css/style.css" rel="stylesheet" type="text/css"/>
  <link href="index/css/newStyle.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="index/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="index/js/index.js"></script>
<script type="text/javascript" src="index/js/banner.js"></script>
  <link href="index/css/swiper/swiper.min.css" rel="stylesheet" type="text/css"/>
  <script type="text/javascript" src="index/js/swiper/swiper.min.js"></script>
<script type="text/javascript" src="index/js/lrtk.js"></script>
<script type="text/javascript" src="index/js/public.js"></script>
<script type="text/javascript" src="index/js/banner_1.js"></script>
<script type="text/javascript" src="index/js/productlist_roll.js"></script>
<!-- 模板Js -->
<script type="text/javascript" src="index/js/template.js"></script>
<!--[if IE 6]>
<script src="index/js/DDPngMin.js"></script>
<script>DD_belatedPNG.fix('.leftimg img,.rightimg img,.ico');</script>
<![endif]-->

<title>首页</title>
</head>
<body>
<div style="width:1100px;height: 107px;margin: 0 auto;">
  <div style="width: 201px;height: 56px;margin-top:25px;float: left;">
    <a href="index">
      <img src="index/images/logo.png"
           width="201" height="56"/>
    </a>
  </div>
  <div class="navHeader" style="width: 768px;height: 107px;float: right;overflow: hidden">
    <ul class="nav">
      <li><a href="index.html">首 页</a></li>
      <li><a href="about.html">关于我们</a></li>
      <li><a href="product.html">服务领域</a></li>
      <li><a href="list_article.html?type=1">新闻动态</a></li>
      <li><a href="contactus.html">联系我们</a></li>
    </ul>
  </div>
</div>
<div class="siber_con">

  <script type="text/javascript" src="index/js/index.js"></script>
  <script type="text/javascript"></script>
  <div id="index-banner" class="">
    <div class="swiper-container">
      <div class="swiper-wrapper">
        <!--          <div th:each="indexPic : ${indexPicList}" class="swiper-slide"  style="background-image: url(<%=SystemManage.getInstance().getSystemSetting().getImageRootPath()%>/${item.pictureUrl});"></div>-->
        <div class="swiper-slide" th:each="indexPic : ${indexPicList}">
          <!--            <div class="imgbox"-->
          <!--                 th:style="${indexPic.pic}?'background:url(' + ${indexPic.pic}+') no-repeat center center;-->
          <!--                 background-size: auto 100%;':''">-->
          <!--                            </div>-->
          <!--            <a th:href="${indexPic.content}"><img th:src="${indexPic.pic}" style="width:100%;height:100%"/></a>-->
          <img th:src="${indexPic.pic}" style="width:100%;height:100%"/>
        </div>

      </div>
      <!-- Add Pagination -->
      <div class="swiper-pagination"></div>
      <div class="swiper-button-next"></div>
      <div class="swiper-button-prev"></div>
    </div>
  </div>
  <script>
    $().ready(function () {
      var mySwiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        autoplay: true,
        effect : 'slide',
        speed:5000,
        autoplayDisableOnInteraction: !1,
        loop: true,
        paginationClickable: !0


      });

    });
  </script>

</div>

<div class="banners" >
  <ul>
    <li class="banners_li">
      <a href="product.html">
        <div>
          <h3>服务领域</h3>
          <p>积分业务</p>
        </div>
      </a>
    </li>
    <li class="banners_li">
      <a href="list_article.html?type=1">
        <div>
          <h3>新闻动态</h3>
          <p>公司动态，行业新闻</p>
        </div>
      </a>
    </li>
    <li class="banners_li banners_li_last">
      <a href="about.html">
        <div>
          <h3>关于我们</h3>
          <p>了解我们，了解淘礼</p>
        </div>
      </a>
    </li>
  </ul>
</div>
<div class="foot">
  <div class="foot_top">
    <div style="width: 1000px;margin: 12px auto 0;overflow: hidden;">
      <ul>
        <li>友情链接：</li>
        <li><a href="https://www.goodemall.com">一路全球跨境购</a></li>
      </ul>
    </div>
  </div>
  <div class="foot_bottom">
    <p>Copyright © 2018 淘礼网有限公司All Rights Reserved       网站建设：淘礼网</p>
    <p>联系电话：028-61666317　         公司地址：成都市金牛区光荣西路67号1幢309号    邮箱：service@goodemall.com</p>
  </div>
</div>
<!-- 新闻模板 -->
<script id="news-content" type="text/html">
	{{each rows as news}}
<li>
   <a href="shownews.html#{{news.cid}}">{{news.title}}</a>
   <span>[{{news.year}}-{{news.monthDay}}]</span>
</li>
	{{/each}}
</script>
<!-- 公告模板 -->
<script id="gonggao-content" type="text/html">
	{{each rows as news}}
<li>
 <span>[{{news.year}}-{{news.monthDay}}]</span> <a href="shownews.html#{{news.cid}}">{{news.title}}</a> 
</li>
	{{/each}}
</script>
<!-- 行业资讯 -->
<script id="zixun-content" type="text/html">
	{{each rows as news}}
       <li>
          <div class="news_list2">
            <h1><a href="shownews.html?id={{news.cid}}"><img src="{{news.pic}}" width="70px" height="55px"/></a></h1>
            <dl>
              <dt><a href="shownews.html?id={{news.cid}}">{{news.title}}</a></dt>
             <dd>{{news.summary}}</dd>
            </dl>
          </div>
        </li>
	{{/each}}
</script>
<script type="text/javascript">
$(function() {
	// 获取第一页新闻信息
	//getNews(1);
	//公告
	//getGongao(1);
	//资讯
	//getzixun(1);
});
/**
 * 获取新闻信息
 */
function getNews(page) {
	var url = 'home/indexinfo/list';
	$.ajax({
		type : 'POST',
		url : url,
		data : {
			'rows' : 3,
			'page' : page
		},
		dataType : 'json',
		success : function(data) {
			for (var i = 0; i < data.rows.length; i++) {
				var row = data.rows[i];
				showApost(row, 40);
			}
			console.log(data);
			$('#newsinfolist').html(template("news-content", data));
			$('#newsinfolistpic').attr('src', data.rows[0].pic);
			//pageNum(data.total, 10, page);
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			swal("错误", "获取数据错误！" + textStatus, "error");
		}
	});
}
/**
 * 获取公告信息
 */
function getGongao(page) {
	var url = 'home/indexinfo/list';
	$.ajax({
		type : 'POST',
		url : url,
		data : {
			'rows' : 2,
			'page' : page
		},
		dataType : 'json',
		success : function(data) {
			for (var i = 0; i < data.rows.length; i++) {
				var row = data.rows[i];
				showApost(row, 40);
			}
			$('#gginfolist').html(template("gonggao-content", data));
			//pageNum(data.total, 10, page);
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			swal("错误", "获取数据错误！" + textStatus, "error");
		}
	});
}
/**
 * 获取公告信息
 */
function getzixun(page) {
	var url = 'home/indexinfo/list';
	$.ajax({
		type : 'POST',
		url : url,
		data : {
			'rows' : 3,
			'page' : page
		},
		dataType : 'json',
		success : function(data) {
			for (var i = 0; i < data.rows.length; i++) {
				var row = data.rows[i];
				showApost(row, 40);
			}
			$('#zxinfolist').html(template("zixun-content", data));
			//pageNum(data.total, 10, page);
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			swal("错误", "获取数据错误！" + textStatus, "error");
		}
	});
}
/**
 * 显示省略号
 */
function showApost(row, num) {
	if (row.content && row.content.length > num) {
	    //row.content=htmldecode(row.content);
		row.content = row.content.substr(0, num) + '...';
	}
	var myDate = new Date(row.gtmCreate);
    var year = myDate.getFullYear();//获取当前年
    var yue = myDate.getMonth()+1;//获取当前月
    var days = myDate.getDate();//获取当前日
	//var dates = row.gtmCreate.split('-');
	row['year'] = year;
	row['monthDay'] = yue + '-' + days;
}
//富文本解析
    function htmldecode(html) {
//1.首先动态创建一个容器标签元素，如DIV
        var temp = document.createElement("div");
        //2.然后将要转换的字符串设置为这个元素的innerHTML(ie，火狐，google都支持)
        temp.innerHTML = html;
        //3.最后返回这个元素的innerText(ie支持)或者textContent(火狐，google支持)，即得到经过HTML解码的字符串了。
        var output = temp.innerText || temp.textContent;
        temp = null;
        return output;
}

</script>
</body>
</html>
